/*
 *      level.h
 *      
 *      2009 Víctor Manuel Ochoa <kanito8a@gmail.com>
 *      
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *      
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *      
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */


#ifndef LEVEL_H
#define LEVEL_H

#include "entity.h"
#include "filereader.h"
#include "texturemanager.h"


const int TILE_SIZE=16;
const int TILE_SIZE_DIV_2=TILE_SIZE/2;
const int MAX_HEIGHT=30;
const int MAX_WIDTH=100;
const char STRING_TEXTURE_FILENAME[] = "texture";
const char STRING_COLUMNS2[] = "columns";
const char STRING_COLUMNS_HEIGHT[] = "columnsheight";


class Level: public Entity
{
	private:
		
		Log *m_pLog;
		char m_name[255];
		char m_tiles[MAX_HEIGHT][MAX_WIDTH];
		Texture *m_texture;
		int m_columns_num;
		
		void drawTile(int _x,int _y);

	public:
		Level();
		bool init(TextureManager *_texturemanager,const char *_cfg_filename);
		void freeMemory();
		void draw();
		void update();
		
		int getDistanceToFloor(int _x,int _y);
		int getDistanceToWall(int _x,int _y);
};

#endif /* LEVEL_H */ 
